package com.aaa.service.impl;

import com.aaa.dao.RoleMapper;
import com.aaa.entity.Role;
import com.aaa.service.RoleService;
import com.aaa.vo.Result;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: keyboard
 * @description:
 * @author: 闫克起2
 * @create: 2024-03-16 15:56
 **/
@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleMapper roleMapper;
    public Result findAll(Integer current,Integer pageSize) {
        PageHelper.startPage(current,pageSize);
        List<Role> roles = roleMapper.selectAll();
        return new Result(200,"查询所有角色",new PageInfo<Role>(roles));
    }

    public Result updateStatus(Integer roleId, Integer status) {
        Integer row = roleMapper.updateStatus(roleId, status);
        if(row==1){
            return new Result(200,"修改状态成功",null);
        }
        return new Result(500,"修改状态失败",null);
    }
}
